﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vroom.Common.IFaces.Loader;
//using Oracle.DataAccess.Client;
using Vroom.Common.Enums;
using LumenWorks.Framework.IO.Csv;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using Vroom.Common.Config;
using Vroom.Common.IFaces.Utils.Logging;
using log4net;
using System.Reflection;
using Vroom.Config;

namespace Vroom.Loaders.Types
{
    public class OracleLoader : IDbLoader
    {
        #region Properties

        public IConfigItem Config                           { get; set; }
        public IConfigUtils ConfigUtils                     { get; set; }
        public Dictionary<string, string> Mappings          { get; set; }
        public List<string> SourceColumns                   { get; set; }
        public List<string> DestinationColumns              { get; set; }
        public Dictionary<string, string> ColumnOverrides   { get; set; }

        public DateTime StartDateTime   { get; set; }
        public DateTime EndDateTime     { get; set; }
        public Guid ClassGuid           { get { return GetType().GUID; } }
        public Guid ExecGuid            { get; set; }
        public IAuditLogger AuditLogger { get; set; }
        private static readonly ILog logger = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        #endregion


        public OracleLoader()
        {
        }
        

        public List<string> GetDestinationSchema()
        {
            #region Comment for now
            //DataTable schema = null;
            //using (var conn = new OracleConnection(DestinationConnectionString))
            //{
            //    using (var cmd = new OracleCommand("SELECT * FROM table", conn))
            //    {
            //        conn.Open();
            //        using (var reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly))
            //        {
            //            schema = reader.GetSchemaTable();
            //        }
            //    }
            //}
            //return schema; 
            #endregion
            throw new NotImplementedException();
        }


        public void BeginLoad()
        {
            throw new NotImplementedException();
            #region Commented for now
            //using (CsvReader csvFile = new CsvReader(new StreamReader(SourceConnectionString), true))
            //{
            //    using (conn = new OracleConnection(DestinationConnectionString))
            //    {
            //        conn.Open();



            //    }
            //} 
            #endregion
        }

    }
}